package com.tinem.platform.module.pojo.co;

/**
 * @author fengzhihao
 * @version v1
 * @program: platform
 * @className JWTCo
 * @description TODO
 * @site 
 * @company 
 * @create 2020-06-18 18:12
 */
public enum  RedisKeyEnum {
    /**
     * websocket 用户在线状态维护：
     * platform:websocket:user:session:{userId}
     * value 0或null 代表不在线
     * value 1 及 1以上代表在线
     */
    websocket_user_online

    /**
     * platform:mqtt:user:online
     * mqtt 用户在线状态事件
     * 保证多个监听情况下只有第一个能处理
     */
    ,mqtt_user_online
    /**
     * platform:mqtt:user:online:event
     * mqtt 用户在线状态事件
     * 保证多个监听情况下只有第一个能处理
     */
    ,mqtt_user_online_event

    /**
     *
     * 网关请求 信息：
     * HGETALL platform:gateway:req:info:6d6ddabe-3a47-4d31-8e0f-7917e8eea735
     * value hash hkey
     * req-timestamp                       //发送请求时间
     * req-accept-timestamp                //接受请求时间
     * X-platform-gateway-req-service
     * X-platform-gateway-req-method
     * X-platform-gateway-req-version
     * X-platform-gateway-req-api_request_id
     * X-platform-gateway-req-jwt
     * X-platform-gateway-req-charset
     * X-platform-gateway-req-lang
     * X-platform-gateway-req-sign_type
     * X-platform-gateway-req-sign
     * X-platform-gateway-req-encryption_type
     * X-platform-gateway-req-encryption_key
     * X-platform-gateway-req-encryption_iv
     * X-platform-gateway-req-debug
     *
     */
    , gateway_req_info
    /**
     * gateway 防止客户端重放攻击
     */
    , gateway_replay
    /**
     *
     * redis 请求流水处理队列
     */
    , gateway_req_info_query
    /**
     * platform:security:verification:code
     */
    , security_verification_code
    /**
     * platform:client:info
     */
    , client_info
    /**
     * platform:gateway:channel:scope
     */
    , channel_scope
    /**
     * 登陆服务的授权码
     * platform:auth:code:
     */
    , auth_code

    /**
     * platform:auth:persistent:code
     */
    , auth_persistent_code
    /**
     *
     * platform:auth:persistent:index:user
     */
    , auth_persistent_index_user

    /**
     * id映射
     * id mapping
     * platform:id:uuid:
     */
    , id_uuid
    /**
     * platform:uuid:id:
     */
    , uuid_id
    /**
     * id mapping 队列
     * LRANGE platform:id:mapping:query 0 10
     * platform:id:mapping:query
     */
    , id_mapping_query
    /**
     * 基于jwt的session实现
     */
    , session_jwt_jti
    /**
     * 基于jwt的session实现
     */
    ;
    public String getKey(String... args){
        StringBuilder sb = new StringBuilder("platform:");
        sb.append(this.name().replaceAll("_",":"));
        for (String s:args){
            sb.append(":");
            sb.append(s);
        }
        return sb.toString();
    }

}
